import Vue from 'vue'
import Router from 'vue-router'
import Home from './pages/home'
import Index from './pages/index'
import Cart from './pages/cart'
import OrderConfirm from './pages/orderConfirm'
import OrderPay from './pages/orderPay'
import Alipay from './pages/alipay'

Vue.use(Router)

export default new Router({
  routes: [{
    path: '/',
    name: 'home',
    component: Home,
    redirect: '/index',
    children: [{
      path: '/index',
      name: 'index',
      component: Index
    }, {
      path: '/product/:id',
      name: 'product',
      component: () => import('./pages/product.vue')
    }, {
      path: '/detail/:id',
      name: 'detail',
      component: () => import('./pages/detail.vue')
    }]
  }, {
    path: '/cart',
    name: 'cart',
    component: Cart
  }, {
    path: '/login',
    name: 'login',
    component: () => import('./pages/login.vue')
  }, {
    path: '/order',
    name: 'order',
    component: () => import('./pages/order.vue'),
    children: [{
      path: 'list',
      name: 'order-list',
      component: () => import('./pages/orderList.vue')
    }, {
      path: 'confirm',
      name: 'order-confirm',
      component: () => import('./pages/orderConfirm.vue')
    }, {
      path: 'pay',
      name: 'order-pay',
      component: () => import('./pages/orderPay.vue')

    }, {
      path: 'alipay',
      name: 'alipay',
      component: () => import('./pages/alipay.vue')
    }]
  }]
})
